<!DOCTYPE html>

<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="include :: header"></head>
<body class="hold-transition skin-yellow sidebar-mini">
<section class="content-header">
    <h1>生产令变更查询</h1>
</section>
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <form id="queryForm" class="form-horizontal">
                        <div class="row">
                            <div class="form-inline">
                                <div class="form-group margin-bottom-none" style="margin-left:0px;margin-right: 25px;">
                                    <label class="control-label">
                                        生产令编号
                                    </label>
                                    <label class="control-label">
                                        <input name="procProdNo" class="form-control" type="text" maxlength="255"
                                               value=""
                                               placeholder="请输入生产令编号"/>
                                    </label>
                                </div>
                                <div class="form-group margin-bottom-none" style="margin-left:0px;margin-right: 25px;">
                                    <label class="control-label">
                                        项目名称
                                    </label>
                                    <label class="control-label">
                                        <input name="procProName" class="form-control" type="text" maxlength="255"
                                               placeholder="请输入项目名称"/>
                                    </label>
                                </div>
                                <div class="form-group margin-bottom-none" style="margin-left:0px;margin-right: 25px;">
                                    <label class="control-label">
                                        变更人
                                    </label>
                                    <label class="control-label">
                                        <input name="procChaUsrName" class="form-control" type="text" maxlength="255"
                                               placeholder="请输入变更人"/>
                                    </label>
                                </div>
                                <div class="form-group margin-bottom-none" style="margin-left:0px;margin-right: 25px;">
                                    <label class="control-label">
                                        变更原因
                                    </label>
                                    <label class="control-label">
                                        <input name="procChaRea" class="form-control" type="text" maxlength="255"
                                               placeholder="请输入变更原因"/>
                                    </label>
                                </div>
                                <div class="form-group margin-bottom-none" style="margin-left:0px;margin-right: 25px;">
                                    <label class="control-label">变更时间</label>
                                    <label class="control-label">
                                        <input type="text" class="form-control datepicker" name="changeStartTime"
                                               readonly="readonly"/>
                                        <span> 至 </span>
                                        <input type="text" class="form-control datepicker" name="changeEndTime"
                                               readonly="readonly"/></label>
                                </div>
                                <button id="btn-search" type="button" class="btn btn-success">
                                    搜索
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
                <div id="toolbar" class="row">
                    <!--                    <button id="btn_getData" class="btn btn-success">获取数据</button>-->
                </div>
                <div class="box-body">
                    <table id="bootstrap-table"></table>
                </div>
            </div>
        </div>
    </div>
</section>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    let table;
    let typArray=['','设备类','其他'];
    let isKeyArray=['否','是'];
    $(function () {
        /**
         * 加载列表
         */
        loadTable();
        /**
         * 表格搜索
         */
        $("#btn-search").click(function () {
            js.table.search(table);
        });
    });

    /**
     * 加载列表
     */
    function loadTable() {
        table = js.table.init({
            url: ctx + "prodOrd/changeQuery/list",
            showColumns: true,
            showExport: true,
            columns: [
                {
                    title: '序号', width: '60',
                    formatter: function (value, row, index, field) {
                        var pageSize = table.bootstrapTable('getOptions').pageSize;
                        var pageNumber = table.bootstrapTable('getOptions').pageNumber;
                        return pageSize * (pageNumber - 1) + index + 1;
                    }
                },
                {
                    title: '生产令编号', field: 'procProdNo',width: '120',
                    formatter: function (value, row, index) {
                        if (value != null) {
                            return value;
                        } else {
                            return '--';
                        }

                    }
                },
                {
                    title: '项目名称', field: 'procProName',width: '230',
                    formatter: function (value, row, index) {
                        if (value != null) {
                            return value;
                        } else {
                            return '--';
                        }

                    }
                },
                {
                    title: '变更内容',
                    formatter: function (value, row, index) {
                        let changeContent="";
                        if(row.befNum!=row.aftNum){
                            changeContent+="<br>数量：【"+row.befNum+"】➨【"+row.aftNum+"】"
                        }
                        if(row.befTyp!=row.aftTyp){
                            changeContent+="<br>设备类别：【"+typArray[row.befTyp]+"】➨【"+typArray[row.aftTyp]+"】"
                        }
                        if(row.befBacTyp!=row.aftBacTyp){
                            changeContent+="<br>产品类别：【"+row.befBacTyp+"】➨【"+row.aftBacTyp+"】";
                        }
                        if(row.befIsKey!=row.aftIsKey){
                            changeContent+="<br>是否重点:【"+isKeyArray[row.befIsKey]+"】➨【"+isKeyArray[row.aftIsKey]+"】";
                        }
                        if(row.befDelDat!=row.aftDelDat){
                            changeContent+="<br>交货期:【"+row.befDelDat+"】➨【"+row.aftDelDat+"】";
                        }
                        if(row.befRem!=row.aftRem){
                            changeContent+="<br>备注:【"+row.befRem+"】➨【"+row.aftRem+"】";
                        }
                        if(changeContent.length>0){
                            changeContent=changeContent.substring(4,changeContent.length);
                        }
                        return changeContent;
                    }, cellStyle: function (value, row, index) {
                            return {css: { "color": "red"}}
                    }
                },
                {
                    title: '变更原因', field: 'procChaRea',width: '160'
                },
                {title: '变更人', field: "procChaUsrName",width: '90'},
                {title: '变更时间', field: "procChaDat",width: '90'}
                // ,
                // {
                //     title: '操作终端信息',width: '175',
                //     formatter: function (value, row, index) {
                //         if(row.procBrowser.indexOf('<br>')>-1){
                //             return "操作系统:" + row.procOs + "<br>" + row.procBrowser.substring(0,row.procBrowser.indexOf('<br>')) + "<br>" + "IP地址：" + row.procIp
                //         }else{
                //             return "操作系统:" + row.procOs + "<br>" + row.procBrowser + "<br>" + "IP地址：" + row.procIp
                //         }
                //
                //     }
                // }
            ]
        });
    }
</script>
</body>
</html>